package com.djf.word.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单实体类
 * 对应表：order_202501
 * 
 * @author djf
 * @since 2025-01-08
 */
@TableName("order_202501")
public class Order {
    
    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @ExcelProperty(value = "订单ID", index = 0)
    private Long id;
    
    /**
     * 订单号
     */
    @TableField("order_no")
    @ExcelProperty(value = "订单号", index = 1)
    private String orderNo;
    
    /**
     * 租户ID
     */
    @TableField("tenant_id")
    @ExcelProperty(value = "租户ID", index = 2)
    private String tenantId;
    
    /**
     * 用户ID
     */
    @TableField("user_id")
    @ExcelProperty(value = "用户ID", index = 3)
    private Long userId;
    
    /**
     * 产品名称
     */
    @TableField("product_name")
    @ExcelProperty(value = "产品名称", index = 4)
    private String productName;
    
    /**
     * 订单总金额
     */
    @TableField("total_amount")
    @ExcelProperty(value = "订单总金额", index = 5)
    private BigDecimal totalAmount;
    
    /**
     * 订单状态
     */
    @TableField("status")
    @ExcelProperty(value = "订单状态", index = 6)
    private String status;
    
    /**
     * 备注
     */
    @TableField("remark")
    @ExcelProperty(value = "备注", index = 7)
    private String remark;
    
    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @ExcelProperty(value = "创建时间", index = 8)
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    
    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @ExcelProperty(value = "更新时间", index = 9)
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;
    
    /**
     * 逻辑删除标识
     */
    @TableField("deleted")
    @TableLogic
    @ExcelIgnore
    private Integer deleted;
    
    // 构造函数
    public Order() {}
    
    public Order(String orderNo, String tenantId, Long userId, String productName, 
                BigDecimal totalAmount, String status, String remark) {
        this.orderNo = orderNo;
        this.tenantId = tenantId;
        this.userId = userId;
        this.productName = productName;
        this.totalAmount = totalAmount;
        this.status = status;
        this.remark = remark;
    }
    
    // Getter and Setter methods
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public String getOrderNo() {
        return orderNo;
    }
    
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    
    public String getTenantId() {
        return tenantId;
    }
    
    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }
    
    public Long getUserId() {
        return userId;
    }
    
    public void setUserId(Long userId) {
        this.userId = userId;
    }
    
    public String getProductName() {
        return productName;
    }
    
    public void setProductName(String productName) {
        this.productName = productName;
    }
    
    public BigDecimal getTotalAmount() {
        return totalAmount;
    }
    
    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }
    
    public String getStatus() {
        return status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    public String getRemark() {
        return remark;
    }
    
    public void setRemark(String remark) {
        this.remark = remark;
    }
    
    public LocalDateTime getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
    
    public LocalDateTime getUpdateTime() {
        return updateTime;
    }
    
    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }
    
    public Integer getDeleted() {
        return deleted;
    }
    
    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }
    
    @Override
    public String toString() {
        return "Order{" +
                "id=" + id +
                ", orderNo='" + orderNo + '\'' +
                ", tenantId='" + tenantId + '\'' +
                ", userId=" + userId +
                ", productName='" + productName + '\'' +
                ", totalAmount=" + totalAmount +
                ", status='" + status + '\'' +
                ", remark='" + remark + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", deleted=" + deleted +
                '}';
    }
}